﻿package model.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import model.business.CustomerType;

@Entity
@Table(name = "Member")
public class Member extends CustomerType {

	@Id
	@GeneratedValue(generator = "Member_ID_Gen", strategy = GenerationType.IDENTITY)
	@SequenceGenerator(name = "Member_ID_Gen", sequenceName = "Member_SEQ_ID")
	private int id;
	
	@Column(nullable = false)
	private String name;
	private String phone;
	private Date brithday;
	
	@Column(nullable = false)
	private int pointAccumulated;
	
	@Column(nullable = false)
	private Date joinDate;

	@ManyToOne(fetch=FetchType.EAGER)
	private MemberLevel memberLevel;
	
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public Date getBrithday() {
		return brithday;
	}

	public void setBrithday(Date brithday) {
		this.brithday = brithday;
	}

	public int getPointAccumulated() {
		return pointAccumulated;
	}

	public void setPointAccumulated(int pointAccumulated) {
		this.pointAccumulated = pointAccumulated;
	}

	public Date getJoinDate() {
		return joinDate;
	}

	public void setJoinDate(Date joinDate) {
		this.joinDate = joinDate;
	}

	public MemberLevel getMemberLevel() {
		return memberLevel;
	}

	public void setMemberLevel(MemberLevel memberLevel) {
		this.memberLevel = memberLevel;
	}

	public int getId() {
		return id;
	}
	
	@Override
	public String toString() {
		return "Member [id=" + id + ", name=" + name + ", phone=" + phone
				+ ", brithday=" + brithday + ", pointAccumulated="
				+ pointAccumulated + ", joinDate=" + joinDate
				+ ", memberLevel=" + memberLevel + "]";
	}

	public void signOut() {

	}

	public void viewPersonalInfo() {

	}
	
	public Member(){
		
	}
}
